// 不能作为jsx中的
import CacheChildren1 from "./CacheChildren1";
import CacheChildren2 from "./CacheChildren2";
import { useState } from "react";
import { useMemo } from "react";
import { useCallback } from "react";

const Cache = () => {
  const [count, setCount] = useState(0);
  console.log("Cache父组件");
  // const handleClick = useMemo(() => () => setCount((pre) => pre + 1), []);
  const handleClick = useCallback(() => setCount((pre) => pre + 1), []);
  return (
    <>
      <h1>Cache</h1>
      <h2>{count}</h2>
      <CacheChildren1 msg={handleClick}></CacheChildren1>
      <CacheChildren2></CacheChildren2>
    </>
  );
};
export default Cache;
